import { SelShow } from '../Edit'
import styles from './index.module.scss'

type Props = {
  type: SelShow['type']
  updateInfo: (type: string, value: number, onClose: () => void) => void
  onClose: () => void
}

// 固定数据
// 性别选项
const genderList = [
  { text: '男', value: 0 },
  { text: '女', value: 1 },
]
// 头像上传选项
const photoList = [
  { text: '拍照', value: 0 },
  { text: '从本地相册选择', value: 1 },
]
const EditList = ({ onClose, updateInfo, type }: Props) => {
  const list = type === 'gender' ? genderList : photoList
  return (
    <div className={styles.root}>
      {/* 选项 */}
      {list.map((item) => (
        <div
          key={item.text}
          onClick={() => {
            updateInfo(type, item.value, onClose)
          }}
          className="list-item"
        >
          {item.text}
        </div>
      ))}
      {/* <div
        onClick={() => {
          updateInfo(type, 0)
        }}
        className="list-item"
      >
        男
      </div>
      <div
        onClick={() => {
          updateInfo(type, 1)
        }}
        className="list-item"
      >
        女
      </div> */}

      <div onClick={onClose} className="list-item">
        取消
      </div>
    </div>
  )
}

export default EditList
